package com.test;

import com.bean.Farmer;
import com.bean.Users;
import com.dao.FarmerDao;
import com.dao.UserDao;

import java.util.*;

public class test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户编号：");
        int bh = sc.nextInt();
        System.out.println("请输入用户类型：");
        String type = sc.next();
        System.out.println("请输入用户名：");
        String name = sc.next();
        System.out.println("请输入用户密码：");
        String password = sc.next();
        System.out.println("请输入用户性别：");
        String gender = sc.next();
        System.out.println("请输入用户电话：");
        String num = sc.next();
        System.out.println("请输入用户邮箱：");
        String email = sc.next();
        System.out.println("请输入用户地址：");
        String address = sc.next();
        if(type.equals("农户")){
            Users user = new Users(bh,type,name,password,gender,num,email,address);
            boolean a = new UserDao().insertUser(user);
            System.out.println("请输入农户姓名：");
            String farmerName = sc.next();
            Farmer farmer = new Farmer(bh,farmerName,password,gender,address,num);
            boolean b = new FarmerDao().insertFarmer(farmer);
        }
        else if(type.equals("消费者")){
            Users user = new Users(bh,type,name,password,gender,num,email,address);
            boolean a = new UserDao().insertUser(user);
        }
        else{ //管理员
            Users user = new Users(bh,type,name,password,gender,num,email,address);
            boolean a = new UserDao().insertUser(user);
        }

    }
}
